﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
using System.Data;
using System.Configuration;

public partial class Pocetna : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
        string conString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|/Hoteli.mdb;"; //postavuvame "adresa" do bazata
        OleDbConnection conn = new OleDbConnection(conString);

        conn.Open();

        string select = "SELECT * FROM Hotel WHERE ID_Grad = ?";
        OleDbCommand select_pole = new OleDbCommand(select, conn);
        select_pole.Parameters.AddWithValue("?", ListBox1.SelectedValue);
        OleDbDataReader reader = select_pole.ExecuteReader();

        
        reader.Read();
        Label5.Text = reader["ime"].ToString();
        Label7.Text = reader["kategorija"].ToString();
       // Label9.Text = reader["id_grad"].ToString();
        Label11.Text = reader["Cena_za_Kupuvanje"].ToString();
        Label13.Text = reader["Cena_za_Poseta"].ToString();
        

        conn.Close();
    }
    
}
